import { createApp } from 'vue'
import App from './App.vue'
import router from "./router/index"
import { initRem } from "./utils/rem"
import 'vant/es/notify/style'
import { createPinia } from "pinia";
import { useOrderDel } from './store/orderDel'
import { drinkDel, orderDel, selectedDel, stapleDel } from './api/orderDel'
initRem();

const app = createApp(App);
const pinia = createPinia();
app.use(pinia); //注入pinia状态机
app.use(router);
app.mount('#app');
// const Order = useOrderDel();
// drinkDel().then(res => {
//   localStorage.setItem('drink', JSON.stringify(res.data.results))
// })
// orderDel().then(res => {
//   localStorage.setItem('hot', JSON.stringify(res.data.results))
//   localStorage.setItem('menu', JSON.stringify(res.data.results))
// })

// selectedDel().then(res => {
//   localStorage.setItem('recommend', JSON.stringify(res.data.results))
//   localStorage.setItem('selected', JSON.stringify(res.data.results))
// })

// stapleDel().then(res => {
//   localStorage.setItem('staple', JSON.stringify(res.data.results))
// })
// let listInfo = localStorage.getItem('carlist')
// let drinkInfo = localStorage.getItem('drink')
// let hotInfo = localStorage.getItem('hot')
// let menuInfo = localStorage.getItem('menu')
// let recommendInfo = localStorage.getItem('recommend')
// let selectedInfo = localStorage.getItem('selected')
// let stapleInfo = localStorage.getItem('staple')


// if (listInfo) {
//   Order.list = JSON.parse(listInfo)
// }
// if (drinkInfo) {
//   Order.all.drink = JSON.parse(drinkInfo)
//   console.log(Order.all.drink)
// }
// if (hotInfo) {
//   Order.all.hot = JSON.parse(hotInfo)
// }
// if (menuInfo) {
//   Order.all.menu = JSON.parse(menuInfo)
// }
// if (recommendInfo) {
//   Order.all.recommend = JSON.parse(recommendInfo)
// }
// if (selectedInfo) {
//   Order.all.selected = JSON.parse(selectedInfo)
// }
// if (stapleInfo) {
//   Order.all.staple = JSON.parse(stapleInfo)
// }
